function Icon(dom, data) {
    this._dom = dom;
    this._data = data;
}

Icon.prototype = {
    onClick: function(func) {
        this._dom.click(func);
    },
    onActivating: function(func) {
        this._onActivatingCallback = func;
    },
    onActivated: function(func) {
        this._onActivatedCallback = func;
    },
    onDeactivated: function(func) {
        this._onDeactivatedCallback = func;
    },
    activate: function() {
        if (this._onActivatingCallback) {
            this._onActivatingCallback();
        }
        this._dom.addClass('active');
        if (this._onActivatedCallback) {
            this._onActivatedCallback();
        }
    },

    isActive: function() {
        return this._dom.hasClass('active');
    },

    deactivate: function() {
        this._dom.removeClass('active');
        if (this._onDeactivatedCallback) {
            this._onDeactivatedCallback();
        }
    },

    removeTitle: function() {
        this._dom.removeAttr("title");
    },

    setTitle: function(title) {
        this._dom.attr("title", title);
    },

    offset: function() {
        return this._dom.offset();
    },

    getDom: function() {
        return this._dom;
    },

    getData: function() {
        return this._data;
    }
};